﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;
using DTO;
using DAL;
namespace BLL
{
    public class NguoiDung_BLL
    {
        public static int dangnhap (NguoiDung_DTO nguoidung)
        {
            try
            {
                DataTable dt = NguoiDung_DAL.Loaddangnhap(nguoidung);
                string tendangnhap = dt.Rows[0]["TENDANGNHAP"].ToString();
                string matkhau = dt.Rows[0]["MATKHAU"].ToString();
                int maloai = Convert.ToInt32(dt.Rows[0]["MALOAI"]);
                if (nguoidung.TENDANGNHAP1 == tendangnhap && nguoidung.MATKHAU1 == matkhau)
                {
                    if (maloai == 1)
                    {
                        return 1;
                    }
                    return 2;
                }
                return 3;
            }
            catch (Exception ex)
            {
                return 3;
            }
        }
        public static string laytenloai(NguoiDung_DTO nguoidung)
        { 
            DataTable dt = NguoiDung_DAL.layquyen(nguoidung);
            string tenloai = Convert.ToString(dt.Rows[0]["TENLOAI"]);
            return tenloai;
        }
    }
}
